package com.czp.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.czp.ssm.bean.UserCard;
import com.czp.ssm.bean.UserCardExample;
import com.czp.ssm.bean.UserCardExample.Criteria;
import com.czp.ssm.dao.UserCardMapper;
import com.czp.ssm.service.UserCardService;
@Service
public class UserCardServiceImpl implements UserCardService {

	
	@Autowired
	private UserCardMapper userCardMapper;
	public UserCard getCardByUserIdAndCardtype(String cardType, String userId) {
		UserCardExample example = new UserCardExample();
		Criteria criteria = example.createCriteria();
		criteria.andCardTypeEqualTo(cardType);
		criteria.andUserIdEqualTo(userId);
		List<UserCard> userCard = userCardMapper.selectByExample(example);
		if (userCard.size() > 0) {
			return userCard.get(0);
		}
		return null;
	}

}
